package cn.wolfcode.luowowo.article.service.impl;

import cn.wolfcode.luowowo.article.domain.HotelDetail;
import cn.wolfcode.luowowo.article.mapper.HotelDetailMapper;
import cn.wolfcode.luowowo.article.service.IHotelDetailService;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class HotelDetailServiceImpl implements IHotelDetailService {

    @Autowired
    private HotelDetailMapper hotelDetailMapper;



    @Override
    public void saveOrUpdate(HotelDetail hotelDetail) {
        if(hotelDetail.getId() == null){
            hotelDetailMapper.insert(hotelDetail);
        }else{
            hotelDetailMapper.updateByPrimaryKey(hotelDetail);
        }
    }

    @Override
    public List<HotelDetail> list() {
        return hotelDetailMapper.selectAll();
    }

    @Override
    public HotelDetail get(Long sid) {
        return hotelDetailMapper.selectByPrimaryKey(sid);
    }

    @Override
    public List<HotelDetail> getByHotelId(Long hotelId) {
        return hotelDetailMapper.seelectByHotelId(hotelId);
    }

}
